package com.zerui.manager.deviceTouch.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zerui.manager.deviceTouch.DeviceTouch;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 设备实体类
 *
 * @author pyzhang
 * @since 2024-04-11
 */
@ApiModel("设备分组")
@Data
@ToString
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "tb_device_touch",autoResultMap = true)
public class DeviceTouchDO  {

    /**
     * 主键
     */
    @ApiModelProperty("主键，无业务含义")
    @TableId(value="id",type= IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;
    /**
     * 设备源自 1：IoT 2：ICC 
     */
    @ApiModelProperty("设备源自 1：IoT 2：ICC ")
    private Integer deviceFrom;
    /**
     * 源记录-设备ID
     */
    @ApiModelProperty("源记录-设备ID")
    private String deviceId;
    /**
     * 源记录-设备编号
     */
    @ApiModelProperty("源记录-设备编号")
    private String deviceCode;
    /**
     * 源记录-设备序列号
     */
    @ApiModelProperty("源记录-设备序列号")
    private String deviceSn;
    /**
     * 源记录-设备名称
     */
    @ApiModelProperty("源记录-设备名称")
    private String deviceName;
    /**
     * 源记录-设备厂商
     */
    @ApiModelProperty("源记录-设备厂商")
    private String deviceManufacturer;
    /**
     * 源记录-设备型号
     */
    @ApiModelProperty("源记录-设备型号")
    private String deviceModel;
    /**
     * 源记录-设备大类  8：门禁
     */
    @ApiModelProperty("源记录-设备大类  8：门禁")
    private String deviceCategory;
    /**
     * 源记录-设备IP地址
     */
    @ApiModelProperty("源记录-设备IP地址")
    private String deviceIp;
    /**
     * 设备账号及通道信息 JSON
     */
    @ApiModelProperty("设备账号及通道信息 JSON")
    private String deviceAccountChannel;
    /**
     * 源记录-分类编号
     */
    @ApiModelProperty("源记录-分类编号")
    private String typeCode;
    /**
     * 源记录-分类名称
     */
    @ApiModelProperty("源记录-分类名称")
    private String typeName;
    /**
     * 源记录-产品代码
     */
    @ApiModelProperty("源记录-产品代码")
    private String productCode;
    /**
     * 源记录-产品名称
     */
    @ApiModelProperty("源记录-产品名称")
    private String productName;
    /**
     * 源记录-节点类型
     */
    @ApiModelProperty("源记录-节点类型")
    private String nodeType;
    /**
     * 源记录-节点类型名称
     */
    @ApiModelProperty("源记录-节点类型名称")
    private String nodeTypeName;
    /**
     * 源记录-所属分组ID
     */
    @ApiModelProperty("源记录-所属分组ID")
    private String groupId;
    /**
     * 源记录-所属分组名称
     */
    @ApiModelProperty("源记录-所属分组名称")
    private String groupName;
    /**
     * 源记录-所属部门ID
     */
    @ApiModelProperty("源记录-所属部门ID")
    private String orgId;
    /**
     * 源记录-所属部门名称
     */
    @ApiModelProperty("源记录-所属部门名称")
    private String orgName;
    /**
     * 源记录-建筑编号
     */
    @ApiModelProperty("源记录-建筑编号")
    private String buildNo;
    /**
     * 源记录-建筑名称
     */
    @ApiModelProperty("源记录-建筑名称")
    private String buildName;
    /**
     * 源记录-楼层编码
     */
    @ApiModelProperty("源记录-楼层编码")
    private String levelNo;
    /**
     * 源记录-楼层名称
     */
    @ApiModelProperty("源记录-楼层名称")
    private String levelName;
    /**
     * 源记录-楼层编码
     */
    @ApiModelProperty("源记录-房间号")
    private String roomNo;
    /**
     * 源记录-楼层名称
     */
    @ApiModelProperty("源记录-房间名称")
    private String roomName;
    /**
     * 源记录-所在位置
     */
    @ApiModelProperty("源记录-所在位置")
    private String position;
    /**
     * 是否在线 0：离线 1：在线
     */
    @ApiModelProperty("是否在线 0：离线 1：在线")
    private Integer isOnline;
    /**
     * 删除标识 0：未删除 1：已删除
     */
    @ApiModelProperty("删除标识 0：未删除 1：已删除")
    private String delFlag;
    /**
     * 同步次数ID
     */
    @ApiModelProperty("同步次数ID")
    private Long touchSyncId;
    /**
     * 同步操作 add、update、delete
     */
    @ApiModelProperty("同步操作 add、update、delete")
    private String touchSyncHandle;
    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;
    /**
     * 创建人
     */
    @ApiModelProperty("创建人")
    private String createBy;
    /**
     * 更新时间
     */
    @ApiModelProperty("更新时间")
    private LocalDateTime updateTime;
    /**
     * 更新人
     */
    @ApiModelProperty("更新人")
    private String updateBy;

    public static DeviceTouchDO of(DeviceTouch deviceTouch) {
        DeviceTouchDO deviceTouchDO = new DeviceTouchDO();
        deviceTouchDO.id = deviceTouch.getId();
        deviceTouchDO.deviceFrom = deviceTouch.getDeviceFrom();
        deviceTouchDO.deviceId = deviceTouch.getDeviceId();
        deviceTouchDO.deviceCode = deviceTouch.getDeviceCode();
        deviceTouchDO.deviceSn = deviceTouch.getDeviceSn();
        deviceTouchDO.deviceName = deviceTouch.getDeviceName();
        deviceTouchDO.deviceManufacturer = deviceTouch.getDeviceManufacturer();
        deviceTouchDO.deviceModel = deviceTouch.getDeviceModel();
        deviceTouchDO.deviceCategory = deviceTouch.getDeviceCategory();
        deviceTouchDO.deviceIp = deviceTouch.getDeviceIp();
        deviceTouchDO.deviceAccountChannel = deviceTouch.getDeviceAccountChannel();
        deviceTouchDO.typeCode = deviceTouch.getTypeCode();
        deviceTouchDO.typeName = deviceTouch.getTypeName();
        deviceTouchDO.productCode = deviceTouch.getProductCode();
        deviceTouchDO.productName = deviceTouch.getProductName();
        deviceTouchDO.nodeType = deviceTouch.getNodeType();
        deviceTouchDO.nodeTypeName = deviceTouch.getNodeTypeName();
        deviceTouchDO.groupId = deviceTouch.getGroupId();
        deviceTouchDO.groupName = deviceTouch.getGroupName();
        deviceTouchDO.orgId = deviceTouch.getOrgId();
        deviceTouchDO.orgName = deviceTouch.getOrgName();
        deviceTouchDO.buildNo = deviceTouch.getBuildNo();
        deviceTouchDO.buildName = deviceTouch.getBuildName();
        deviceTouchDO.position = deviceTouch.getPosition();
        deviceTouchDO.isOnline = deviceTouch.getIsOnline();
        deviceTouchDO.delFlag = deviceTouch.getDelFlag();
        deviceTouchDO.touchSyncId = deviceTouch.getTouchSyncId();
        deviceTouchDO.touchSyncHandle = deviceTouch.getTouchSyncHandle();
        deviceTouchDO.createTime = deviceTouch.getCreateTime();
        deviceTouchDO.createBy = deviceTouch.getCreateBy();
        deviceTouchDO.updateTime = deviceTouch.getUpdateTime();
        deviceTouchDO.updateBy = deviceTouch.getUpdateBy();
        return deviceTouchDO;
    }

    public DeviceTouch toDomain() {
        DeviceTouch deviceTouch = new DeviceTouch();
        deviceTouch.setId(this.id);
        deviceTouch.setDeviceFrom(this.deviceFrom);
        deviceTouch.setDeviceId(this.deviceId);
        deviceTouch.setDeviceCode(this.deviceCode);
        deviceTouch.setDeviceSn(this.deviceSn);
        deviceTouch.setDeviceName(this.deviceName);
        deviceTouch.setDeviceManufacturer(this.deviceManufacturer);
        deviceTouch.setDeviceModel(this.deviceModel);
        deviceTouch.setDeviceCategory(this.deviceCategory);
        deviceTouch.setDeviceIp(this.deviceIp);
        deviceTouch.setDeviceAccountChannel(this.deviceAccountChannel);
        deviceTouch.setTypeCode(this.typeCode);
        deviceTouch.setTypeName(this.typeName);
        deviceTouch.setProductCode(this.productCode);
        deviceTouch.setProductName(this.productName);
        deviceTouch.setNodeType(this.nodeType);
        deviceTouch.setNodeTypeName(this.nodeTypeName);
        deviceTouch.setGroupId(this.groupId);
        deviceTouch.setGroupName(this.groupName);
        deviceTouch.setOrgId(this.orgId);
        deviceTouch.setOrgName(this.orgName);
        deviceTouch.setBuildNo(this.buildNo);
        deviceTouch.setBuildName(this.buildName);
        deviceTouch.setPosition(this.position);
        deviceTouch.setIsOnline(this.isOnline);
        deviceTouch.setDelFlag(this.delFlag);
        deviceTouch.setTouchSyncId(this.touchSyncId);
        deviceTouch.setTouchSyncHandle(this.touchSyncHandle);
        deviceTouch.setCreateTime(this.createTime);
        deviceTouch.setCreateBy(this.createBy);
        deviceTouch.setUpdateTime(this.updateTime);
        deviceTouch.setUpdateBy(this.updateBy);
        return deviceTouch;
    }
}
